PROJECT(zlibcdec)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
IF(NOT CMAKE_BUILD_TYPE)
	SET(CMAKE_BUILD_TYPE Debug)
ENDIF(NOT CMAKE_BUILD_TYPE)
CMAKE_POLICY( SET CMP0002 OLD)
IF(CMAKE_BUILD_TYPE STREQUAL Debug)
	ADD_DEFINITIONS(-D_DEBUG)
	SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../product/linuxd)
	LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/../product/linuxd)
ELSE(CMAKE_BUILD_TYPE STREQUAL Debug)
	ADD_DEFINITIONS(-DNDEBUG)
	SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../product/linux)
        LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/../product/linuxd)
ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)

SET(CMAKE_C_FLAGS_DEBUG "-g -W -O0")
SET(CMAKE_CXX_FLAGS_DEBUG "-g -W -O0")
SET(CMAKE_C_FLAGS_RELEASE "-g -fno-strict-aliasing -W -O2")
SET(CMAKE_CXX_FLAGS_RELEASE "-g -fno-strict-aliasing -W -O2")

ADD_DEFINITIONS(-std=c++0x)

INCLUDE_DIRECTORIES(
	.
)

ADD_DEFINITIONS(
	-D_USRDLL
	-DZLIBCDEC_EXPORTS
	-D_MODULE_NAME=zlibcdec
	)
	
FILE(GLOB_RECURSE CPP_LIST "*.cpp")
FOREACH(cpp ${CPP_LIST})
	ADD_LIBRARY(zlibcdec SHARED ${cpp})
ENDFOREACH(cpp)

SET_SOURCE_FILES_PROPERTIES(
	PROPERTIES HEADER_FILE_ONLY true 
	)
TARGET_LINK_LIBRARIES(zlibcdec dl iconv)
